const Koa = require('koa')
const views = require('koa-views')
const Router = require('koa-router')
const static = require('koa-static')
const path = require('path')

const indexRouter = require('./src/router/index')

const app =new  Koa()
let viewPath = path.join(__dirname,'./src/views')
app.use(views(viewPath,{
  extension:'ejs'
}))

let staticPath= path.join(__dirname,'./src/public')
app.use(static(staticPath));

const router = new Router();
router.use('/api',indexRouter.routes())
app.use(router.routes())
app.listen(3003,()=>{
  console.log('localhost:3000 start')
})